

package com.hazelcast.client.impl.protocol.task.ringbuffer;

import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.impl.protocol.task.AbstractPartitionMessageTask;
import com.hazelcast.config.RingbufferConfig;
import com.hazelcast.instance.impl.Node;
import com.hazelcast.internal.nio.Connection;
import com.hazelcast.ringbuffer.impl.RingbufferService;

public abstract class AbstractRingbufferMessageTask<T> extends AbstractPartitionMessageTask<T> {

    public AbstractRingbufferMessageTask(ClientMessage clientMessage, Node node, Connection connection) {
        super(clientMessage, node, connection);
    }

    @Override
    public String getServiceName() {
        return RingbufferService.SERVICE_NAME;
    }

    @Override
    protected String getUserCodeNamespace() {
        RingbufferService service = nodeEngine.getService(getServiceName());
        RingbufferConfig config = service.getRingbufferConfig(getDistributedObjectName());
        return config == null ? null : config.getUserCodeNamespace();
    }
}
